/**
 * 加载发货记录
 */
function loadSendList() {

	$.ajax({
					headers:{
						"X-Access-Token":getCookie("token")
					},
				    type: "GET",
				    url: "http://192.168.1.192:8080/jeecg-boot/procedure/proc/list", //与此php页
				    dataType: 'json', //从php返回的值以 JSON方式 解释
					contentType: 'application/json',
				    data: 'pageSize=20'+'&pageNo=1', //
				    success: function (json) {//如果调用php成功
				        sendlist = json.result.records;
						var chtml = '';
						//var chtml = '';
						if (!empty(sendlist)) {
							for (var i = 0; i < sendlist.length; i++) {
								if (!empty(sendlist[i])) {
									chtml = chtml + '<div class="ProductsListContent">';
									chtml = chtml + '<div class="ProductsDetails">';
									chtml = chtml + '<p>工序单号：' + sendlist[i].code + '</p>';
									chtml = chtml + '<p>工序名称：' + sendlist[i].name + '</p>';
									chtml = chtml + '</li>';
									chtml = chtml + '</ul>';
									chtml = chtml + '</div>';
									chtml = chtml + '</div>';
								}
							}
						}

						$("#sendList").html(chtml);
						showpage(json.total_results,json.page_no,json.page_size,getwindowhref());
				    },
				    error:function(json){
				        alertMessage(JSON.stringify(json));
				    }
				});


}
function showSend(sendlist) {
	var chtml = '';
    //var chtml = '';
    if (!empty(sendlist)) {
        for (var i = 0; i < sendlist.length; i++) {
            if (!empty(sendlist[i])) {
            	chtml = chtml + '<div class="ProductsListContent">';
            	chtml = chtml + '<div class="ProductsDetails">';
    			chtml = chtml + '<p>工序单号：' + sendlist[i].code + '</p>';
    			chtml = chtml + '<p>工序名称：' + sendlist[i].name + '</p>';
    			chtml = chtml + '</li>';
    			chtml = chtml + '</ul>';
    			chtml = chtml + '</div>';
    			chtml = chtml + '</div>';


            }
        }
    }

    $("#sendList").html(chtml);
}

function rightHua2(){
	var plch = $('.ProductsDetails').height();
	$('.AllContent').css({backgroundColor:'#f3f3f3'});
	$('.moreOperation p').css({paddingTop:plch/2-5,paddingBottom:plch/2-5});
	$('.ProductsDetails').on('click',function(){

		$(this).next('.moreOperation').show().animate({right:'-80%'},100);
		$(this).animate({left:'-60%'},300);
	});

	$('.prtsBack').on('click',function(){
		$(this).parent().animate({right:'-100%'},300);
		$(this).parent().prev().animate({left:'0%'},300);
	})


}

/**
 * 加载栈板记录
 */
function loadStackList() {
    $.ajax({
        type: "GET",
        url: getServerUrl() + "/almes/admin/manufacture/pallets/listData", //与此php页面沟通
        dataType: 'json', //从php返回的值以 JSON方式 解释
        data: 'rows='+20+'&page='+getPageNo(), //
        success: function (json) {//如果调用php成功
            stacklist = json.rows;
            showStack(stacklist);
            showpage(json.total_results,json.page_no,json.page_size,getwindowhref());
        },
        error:function(json){
            // alertMessage(json.errordescription);
        }
    });

}
function showStack(stackList) {
	var chtml = '';
    //var chtml = '';
    if (!empty(stackList)) {
        for (var i = 0; i < stackList.length; i++) {
            if (!empty(stackList[i])) {
            	chtml = chtml + '<div class="ProductsListContent">';
            	chtml = chtml + '<div class="ProductsDetails">';
    			chtml = chtml + '<p>工序编号：' + stackList[i].code + '</p>';
    			chtml = chtml + '<p>工序名称：' + stackList[i].name + '</p>';
    			chtml = chtml + '</li>';
    			chtml = chtml + '</ul>';
    			chtml = chtml + '</div>';
    			chtml = chtml + '<div class="moreOperation">';
				chtml = chtml + '<p><a href="taskList.html?id=' + sendList[i].id + '" >报工</a></p>';
    			chtml = chtml + '</div>';
    			chtml = chtml + '</div>';


            }
        }
    }

    $("#stackList").html(chtml);
	rightHua2();
}
